﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Admin.Master" AutoEventWireup="true"
   ValidateRequest="false" CodeBehind="editProduct.aspx.cs"  Inherits="PHTShop.admin.editProduct" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="ck/ckfinder/ckfinder.js" type="text/javascript"></script>
    <script src="js/jquery.validate.js" type="text/javascript"></script>
    <script src="ck/ckeditor/ckeditor.js" type="text/javascript"></script>
    <script type="text/javascript">



        function checkNumber(sender, args) {
            var num = document.getElementById('<%=textboxPrice.ClientID %>').value;

            if (isNaN(num)) {
                args.IsValid = false;
            }
            else {

                args.IsValid = true;
            }
        }

        function checkNumber1(sender, args) {
            var num = document.getElementById('<%=textboxQuantity.ClientID %>').value;

            if (isNaN(num)) {
                args.IsValid = false;
            }
            else {

                args.IsValid = true;
            }
        }

        function checkNumber2(sender, args) {

            var num = document.getElementById('<%=textboxDiscount.ClientID %>').value;


            if (isNaN(num)) {
                args.IsValid = false;
            }
            else {

                args.IsValid = true;
            }
        }
        $(function () {

            var editor;
            function createEditor(languageCode, id) {
                var editor = CKEDITOR.replace(id, {
                    language: languageCode
                });
            }

            createEditor('en', '<%=TextboxDescription_en.ClientID %>');
            createEditor('en', '<%=TextboxDescriptionFr.ClientID %>');
            createEditor('en', '<%=TextboxDescriptionGr.ClientID %>');

            //upload image
            var btn = $('#btnImg1');
            var img = $('#<%=textboxURL1.ClientID %>');
            setActionUpload(btn, img);



            function setActionUpload(btn, img) {
                $(btn).click(function () {
                    var finder = new CKFinder();
                    finder.selectActionFunction = function (fileUrl) {
                        $(img).val(fileUrl);
                    };
                    finder.popup();
                });
            }
            //upload image

            // remove table border
            $('.removeBorder td').css('border', 'none');
            // remove table border

        })
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </ajaxToolkit:ToolkitScriptManager>
    <div id="title" class="b2">
        <p>
        </p>
        <h2>
            Create Product</h2>
    </div>
    <div class="removeBorder">
        <ajaxToolkit:TabContainer ID="TabContainer1" runat="server">
            <ajaxToolkit:TabPanel HeaderText="English" ID="TabPanel1" runat="server">
                <ContentTemplate>
                    <table style="width: 100%; border: none">
                        <tr>
                            <td>
                                <asp:Label ForeColor="BlueViolet" ID="Label1" runat="server" Text="Product name"></asp:Label>
                            </td>
                            <td>
                                <input type="text" title="Fusce elementum" id="TextboxName_en" name="field1c" runat="server"
                                    class="text" />
                                <span class="required-icon tooltip">Required</span>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label2" ForeColor="BlueViolet" runat="server" Text="Product Description"></asp:Label>
                            </td>
                            <td>
                                <textarea runat="server" id="TextboxDescription_en" name="field4b" cols="10" rows="10"></textarea>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </ajaxToolkit:TabPanel>
            <ajaxToolkit:TabPanel HeaderText="France" ID="TabPanel2" runat="server">
                <ContentTemplate>
                    <table style="width: 100%; border: none">
                        <tr>
                            <td>
                                <asp:Label ForeColor="Brown" ID="Label4" runat="server" Text="Product name"></asp:Label>
                            </td>
                            <td>
                                <input type="text" title="Fusce elementum" id="TextboxName_fr" name="field1c" runat="server"
                                    class="text" /><span class="required-icon tooltip">Required</span>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label3" ForeColor="Brown" runat="server" Text="Product Description"></asp:Label>
                            </td>
                            <td>
                                <textarea runat="server" id="TextboxDescriptionFr" cols="10" rows="10"></textarea>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </ajaxToolkit:TabPanel>
            <ajaxToolkit:TabPanel HeaderText="Germany" ID="TabPanel3" runat="server">
                <ContentTemplate>
                    <table style="width: 100%; border: none">
                        <tr>
                            <td>
                                <asp:Label ForeColor="Chocolate" ID="Label5" runat="server" Text="Product name"></asp:Label>
                            </td>
                            <td>
                                <input type="text" title="Fusce elementum" id="TextboxName_gr" name="field1c" runat="server"
                                    class="text" />
                                <span class="required-icon tooltip">Required</span>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label6" ForeColor="Chocolate" runat="server" Text="Product Description"></asp:Label>
                            </td>
                            <td>
                                <textarea runat="server" id="TextboxDescriptionGr" cols="10" rows="10"></textarea>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </ajaxToolkit:TabPanel>
        </ajaxToolkit:TabContainer>
    </div>
    <asp:Label ID="Label_proname" runat="server" ForeColor="Red" Text=""></asp:Label>
    <fieldset>
        <legend>
            <asp:Label ID="Label12" runat="server" Font-Bold="true" Text="Details"></asp:Label></legend>
        <table class="removeBorder" style="width: 100%; border: none">
            <tr>
                <td>
                    <asp:Label ID="Label7" runat="server" Text="Price"></asp:Label>
                </td>
                <td>
                    <div class="field required">
                        <input type="text" title="Fusce elementum" id="textboxPrice" runat="server" name="field1c"
                            class="text" />
                        <span class="required-icon tooltip">Required</span>
                    </div>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="textboxPrice"
                        Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
                    <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Number only"
                        ClientValidationFunction="checkNumber" ControlToValidate="textboxPrice" Display="Dynamic"
                        ValidateEmptyText="True"></asp:CustomValidator>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label8" runat="server" Text="Quantity"></asp:Label>
                </td>
                <td>
                    <input type="text" title="Fusce elementum" id="textboxQuantity" runat="server" name="field1c"
                        class="text" />
                    <span class="required-icon tooltip">Required</span>
                </td>
                <td>
                    &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="textboxQuantity"
                        Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
                    <asp:CustomValidator ID="CustomValidator2" runat="server" ClientValidationFunction="checkNumber1"
                        ControlToValidate="textboxQuantity" ErrorMessage="Number only" ValidateEmptyText="True"></asp:CustomValidator>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label9" runat="server" Text="Category"></asp:Label>
                </td>
                <td>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:DropDownList ID="DropDownList1" runat="server" OnDataBound="DropDownList1_DataBound">
                            </asp:DropDownList>
                            <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged">
                            </asp:DropDownList>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label11" runat="server" Text="Feather"></asp:Label>
                </td>
                <td>
                    <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
                        BorderStyle="None" CssClass="removeBorder">
                        <asp:ListItem Selected="True" Value="1">Yes</asp:ListItem>
                        <asp:ListItem Value="0">No</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label10" runat="server" Text="Discount"></asp:Label>
                </td>
                <td>
                    <div class="field required">
                        <input type="text" title="Fusce elementum" id="textboxDiscount" runat="server" name="field1c"
                            class="text" />
                        <span class="required-icon tooltip">Required</span></div>
                </td>
                <td>
                    <asp:CustomValidator ID="CustomValidator3" runat="server" ControlToValidate="textboxDiscount"
                        ErrorMessage="Number only" ClientValidationFunction="checkNumber2" ValidateEmptyText="True"></asp:CustomValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Partner
                </td>
                <td>
                    <asp:DropDownList ID="DropDownList3" runat="server">
                    </asp:DropDownList>
                </td>
                <td>
                </td>
            </tr>
        </table>
    </fieldset>
    <fieldset>
        <legend>
            <asp:Label ID="Label13" runat="server" Font-Bold="true" Text="Images"></asp:Label></legend>
        <table class="removeBorder" style="width: 100%; border: none">
            <tr>
                <td>
                    <asp:Label ID="Label14" runat="server" Text="Image 1"></asp:Label>
                </td>
                <td>
                    <div class="field required">
                        <input type="text" title="Fusce elementum" id="textboxURL1" runat="server" name="field1c"
                            class="text" />
                        <input id="btnImg1" type="button" value="Upload" />
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Repeater ID="Repeater1" runat="server">
                        <ItemTemplate>
                            <div style="padding:10px;float:left">
                             <img width="50" height="50" alt="" src='<%# Eval("name") %>' />
                                <br />
                            <asp:HyperLink onclick="return confirm('are you sure?')"
                             ID="HyperLink1" NavigateUrl='<%# "delete.aspx?id="+ Eval("id") %>' runat="server">Delete</asp:HyperLink>
                            </div>
                           
                        </ItemTemplate>
                    </asp:Repeater>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
    </fieldset>
    <%--  show all product to set product relative--%>
    <fieldset>
        <legend>
            <asp:Label ID="Label17" runat="server" Font-Bold="true" Text="Product Relative"></asp:Label></legend>
        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
            <ContentTemplate>

               

                <asp:ListView ID="ListView1" runat="server" OnItemDataBound="ListView1_ItemDataBound">
                    <LayoutTemplate>
                        <table cellspacing="0" id="postList" class="listTable">
                            <!-- Thead -->
                            <thead>
                                <tr>
                                    <th class="header">
                                        <a title="Post" href="#">Choose</a>
                                    </th>
                                    <th class="header">
                                        <a title="Post" href="#">Product name</a>
                                    </th>
                                </tr>
                            </thead>
                            <!-- /Thead -->
                            <!-- Tfoot -->
                            <%--	<tfoot>
						<tr>
							<td colspan="5">
								<div class="inner">
									<div class="paginate">
										<span class="prev disabled"><a href="#">&lt;&lt;</a></span>
										<span><a href="#">1</a></span>
										<span>...</span>
										<span><a href="#">4</a></span>
										<span class="current roundedBordersLite">5</span>
										<span><a href="#">6</a></span>
										<span>...</span>
										<span><a href="#">11</a></span>
										<span class="next"><a href="#">&gt;&gt;</a></span>
									</div>
								</div>
							</td>
						</tr>
					</tfoot>--%>
                            <!-- /Tfoot -->
                            <!-- Tbody -->
                            <tbody>
                                <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                            </tbody>
                            <!-- /Tbody -->
                        </table>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr>
                            <td>
                                <asp:CheckBox ID="CheckBox1" runat="server" />
                            </td>
                            <asp:HiddenField ID="HiddenField1" Value='<%# Eval("productsId") %>' runat="server" />
                            <td>
                                <a title="Lorem Ipsum" href="#">
                                    <%# Eval("name") %></a>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:ListView>
            </ContentTemplate>
        </asp:UpdatePanel>
    </fieldset>
    <br />
    <asp:Button class="css_btn_class" ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />
</asp:Content>
